<template>
  <div v-if="visible" class="loading-overlay">
    <div class="loading-content">
      <i class="el-icon-loading loading-icon"></i>
      <p class="loading-text">{{ text }}</p>
    </div>
  </div>
</template>

<script>
export default {
  name: 'LoadingOverlay',
  props: {
    visible: {
      type: Boolean,
      default: false
    },
    text: {
      type: String,
      default: '正在处理数据，请稍候...'
    }
  }
}
</script>

<style lang="scss" scoped>
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;

  .loading-content {
    background-color: #fff;
    padding: 30px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 200px;

    .loading-icon {
      font-size: 40px;
      color: #409EFF;
      margin-bottom: 15px;
      display: block;
      animation: rotate 2s linear infinite;
    }

    .loading-text {
      font-size: 16px;
      color: #606266;
      margin: 0;
      line-height: 1.5;
    }
  }
}

@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}
</style> 